package com.kahluastudios.mealfinder.desktop.client.common;

import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ChangeListener;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.InlineHTML;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment;

public class RestaurantSearchPanel extends HorizontalPanel {
	
	private Label searchLabel;	
	private ListBox searchTypeListBox;
	private ListBox distanceListBox;
	private TextBox searchFilter;
	private Button goButton;
	
	public RestaurantSearchPanel() {
		setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
		setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);		
		this.searchLabel = new Label("Search by Name or Cuisine, and Location ");
		add(this.searchLabel);
		this.searchLabel.getElement().getStyle().setMargin(10, Unit.PX);
		
		this.searchFilter = new TextBox();
		this.searchFilter.setAlignment(TextAlignment.LEFT);
		this.searchFilter.setDirectionEstimator(true);
		this.searchFilter.getElement().getStyle().setMarginRight(10, Unit.PX);
		this.searchFilter.setWidth("243px");
		add(this.searchFilter);
		
		this.goButton = new Button("Go");
		add(this.goButton);		
	}

	private void initialiseDistanceListBox() {
		this.distanceListBox.addItem("1 mile");
		this.distanceListBox.addItem("3 miles");		
		this.distanceListBox.addItem("5 miles");
		this.distanceListBox.addItem("10 miles");
		this.distanceListBox.addItem("20 miles");
		this.distanceListBox.addItem("40 miles");
		this.distanceListBox.addItem("80 miles");
		this.distanceListBox.setWidth("131px");
	}

	private void initialiseSearchTypeListBox() {
		this.searchTypeListBox.addItem("Name");
		this.searchTypeListBox.addItem("City/Town/Area");
		this.searchTypeListBox.addItem("Post Code");
		this.searchTypeListBox.setWidth("131px");		
	}	
}